<?php
//No direct access
defined('_JEXEC') or die('Restricted access');
?>
<div id="ownservices">
	<div id="mainownservice">
		<h3><?php echo JText::_('OWNSERVICE_MEMBERS'); ?></h3>
		<hr />
		<form action="index.php" method="post" name="adminForm" id="adminForm">
			<table>
				<tr>
					<td width="100%">
						<?php echo JText::_( 'OWNSERVICE_FILTER' ); ?>:<input type="text" name="search" value="<?php echo htmlspecialchars($this->lists['search']);?>"  onchange="document.adminForm.submit();" />
						<button onclick="this.form.submit();" class="button"><?php echo JText::_( 'Go' ); ?></button>
						<button onclick="document.adminForm.search.value='';this.form.submit();" class="button"><?php echo JText::_( 'Reset' ); ?></button>
					</td>
					<td nowrap="nowrap">
						<?php
							if(isset($this->lists['branch'])){
								echo $this->lists['branch'];
							}
						?>
					</td>
				</tr>
			</table>
			<table class="adminlist" cellspacing="1">
				<thead>
				<tr>
					<td align="center" class="tablelist"><?php echo JText::_('NUM'); ?></td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_USERNAME', 'u.username', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_FIRSTNAME', 'p.firstname', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_LASTNAME', 'p.lastname', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_BIRTHDAY', 'p.birthday', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_PHONE', 'p.phone', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
					<td align="center" class="tablelist"><?php echo JHTML::_('grid.sort',  'OWNSERVICE_EXPIRE_DATE', 'p.expire_date', $this->lists['order_Dir'], $this->lists['order'] ); ?></td>
				</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="7"><?php echo $this->pageNav->getListFooter(); ?></td>
					</tr>
				</tfoot>
				<tbody>
					<?php
						$k 				= 0;
						$dateformat  	= OwnserviceHelper::getParams('date_format', '%d/%m/%Y');
						for ($i=0, $n=count($this->rows); $i < $n; $i++) {
						$row = $this->rows[$i];
					?>
						<tr class="<?php echo "row$k"; ?>">
							<td><?php echo $this->pageNav->getRowOffset( $i ); ?></td>
							<td>
								<a href="javascript:void(0);" onclick="window.parent.selectUser('<?php echo $row->user_id; ?>', '<?php echo $row->username.' '.$row->firstname.' '.$row->lastname; ?>');">
									<?php echo $row->username; ?>
								</a>
							</td>
							<td>
								<?php echo $row->firstname; ?>
							</td>
							<td>
								<?php echo $row->lastname; ?>
							</td>
							<td align="center">
								<?php echo JHTML::_('date', $row->birthday, $dateformat); ?>
							</td>
							<td>
								<?php echo $row->phone_no; ?>
							</td>
							<td align="center">
								<?php echo JHTML::_('date', $row->expire_date, $dateformat); ?>
							</td>
						</tr>
					<?php 
						} 
					?>
				</tbody>
			</table>
			<input type="hidden" name="boxchecked" value="0" />
			<input type="hidden" name="option" value="com_ownservice" />
			<input type="hidden" name="view" value="userselement" />
			<input type="hidden" name="tmpl" value="component" />
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
			<input type="hidden" name="filter_order_Dir" value="<?php echo $this->lists['order_Dir']; ?>" />
			<?php echo JHTML::_( 'form.token' ); ?>
		</form>
	</div>	
</div>